package com.sapient.mompoc;

import java.util.ArrayList;

import com.sapient.mompoc.model.LineItem;
import com.sapient.mompoc.model.Order;
import com.sapient.mompoc.model.Product;
import com.sapient.mompoc.service.OrderService;
import com.sapient.mompoc.service.ProductService;
import com.sapient.mompoc.service.utils.ServiceUtils;

/**
 * Hello world!
 * 
 */
public class App {
	public static void main(String[] args) {

		ProductService productService = ServiceUtils.getProductService();
		System.out.println(productService.getProducts());

		OrderService orderServiceImpl = ServiceUtils.getOrderService();

		Product product = orderServiceImpl.getProduct(2313L);

		LineItem item = new LineItem();
		item.setId(111L);
		item.setProduct(product);
		item.setQuantity(10);

		ArrayList<LineItem> list = new ArrayList<LineItem>();
		list.add(item);

		Order order = new Order(1L, list);

		orderServiceImpl.persist(order);
		orderServiceImpl.delete(1L);

		System.out.println(orderServiceImpl.getOrder(1L));

	}
}
